Merge "Catch rollback exceptions in API exception handling"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 6 Apr 2015 17:35:42 +0000 (17:35 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 6 Apr 2015 17:35:42 +0000 (17:35 +0000)
includes/api/ApiMain.php

index 1feb485..2978453 100644 (file)
@@ -416,7 +416,13 @@ class ApiMain extends ApiBase {
                // Bug 63145: Rollback any open database transactions
                if ( !( $e instanceof UsageException ) ) {
                        // UsageExceptions are intentional, so don't rollback if that's the case
-                       MWExceptionHandler::rollbackMasterChangesAndLog( $e );
+                       try {
+                               MWExceptionHandler::rollbackMasterChangesAndLog( $e );
+                       } catch ( DBError $e2 ) {
+                               // Rollback threw an exception too. Log it, but don't interrupt
+                               // our regularly scheduled exception handling.
+                               MWExceptionHandler::logException( $e2 );
+                       }
                }
 
                // Allow extra cleanup and logging